package com.rboat.exam.service.impl;

import java.util.List;
import com.rboat.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.rboat.exam.mapper.ExamTestPaperMapper;
import com.rboat.exam.domain.ExamTestPaper;
import com.rboat.exam.service.IExamTestPaperService;
import com.rboat.common.core.text.Convert;

/**
 * 试卷Service业务层处理
 * 
 * @author rboat
 * @date 2019-09-02
 */
@Service
public class ExamTestPaperServiceImpl implements IExamTestPaperService 
{
    @Autowired
    private ExamTestPaperMapper examTestPaperMapper;

    /**
     * 查询试卷
     * 
     * @param id 试卷ID
     * @return 试卷
     */
    @Override
    public ExamTestPaper selectExamTestPaperById(String id)
    {
        return examTestPaperMapper.selectExamTestPaperById(id);
    }

    /**
     * 查询试卷列表
     * 
     * @param examTestPaper 试卷
     * @return 试卷
     */
    @Override
    public List<ExamTestPaper> selectExamTestPaperList(ExamTestPaper examTestPaper)
    {
        return examTestPaperMapper.selectExamTestPaperList(examTestPaper);
    }

    /**
     * 新增试卷
     * 
     * @param examTestPaper 试卷
     * @return 结果
     */
    @Override
    public int insertExamTestPaper(ExamTestPaper examTestPaper)
    {
        examTestPaper.setCreateTime(DateUtils.getNowDate());
        return examTestPaperMapper.insertExamTestPaper(examTestPaper);
    }

    /**
     * 修改试卷
     * 
     * @param examTestPaper 试卷
     * @return 结果
     */
    @Override
    public int updateExamTestPaper(ExamTestPaper examTestPaper)
    {
        examTestPaper.setUpdateTime(DateUtils.getNowDate());
        return examTestPaperMapper.updateExamTestPaper(examTestPaper);
    }

    /**
     * 删除试卷对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteExamTestPaperByIds(String ids)
    {
        return examTestPaperMapper.deleteExamTestPaperByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除试卷信息
     * 
     * @param id 试卷ID
     * @return 结果
     */
    @Override
    public int deleteExamTestPaperById(String id)
    {
        return examTestPaperMapper.deleteExamTestPaperById(id);
    }
}
